home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Science / RLaB / examples / freq_plot.r < prev    next >
Text File  |  1994-04-26  |  548b  |  27 lines

  1. // Example plot
  2.  
  3. t = (0:10:.05)';
  4. x = exp (-0.5*t) .* (cos (2*pi*3*t) + sin (2*pi*7*t));
  5. X = fft (x);
  6. rfile faxis
  7. freq = faxis (X, .05, 3);
  8. mag = abs (X);
  9. rfile angle
  10. phase = angle (X);
  11. pstart (1,2,"Mac");
  12. plfont(2);  // Roman font
  13. plwid(2);   // line width
  14.  
  15. ptitle ("Magnitude of FFT");
  16. xlabel ("Frequency #gw (Hertz)");  // omega
  17. plot ([freq,mag]);
  18.  
  19. ptitle ("Angle (tan#u-1#d(imag/real)) of FFT");
  20. xlabel ("Frequency #gw (Hertz)");
  21. ylabel ("Angle (radians)");
  22. plot ([freq,phase]);
  23. pause();
  24.  
  25. //send Postscript output to p3.ps
  26. //plprint ("p3.ps");
  27.